<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico" >
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/static/admin/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/static/admin/css/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/static/admin/css/style.css" />
<!--/meta 作为公共模版分离出去-->
<title>编辑用户</title>
</head>
<body ng-controller="main">
<article class="page-container">
	<form action="<?php url('user/userSave')?>" method="post" class="form form-horizontal" id="form-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">用户ID：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<span><?php echo $info['id']?></span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">用户账号：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<span><?php echo $info['username']?></span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>昵称：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="<?php echo $info['nickname']?>" placeholder="请输入昵称" id="nickname" name="nickname">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>性别：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="radio" class="radio-box" id="sex-man" value="0" name="sex" <?php if($info['sex'] == 0) echo 'checked';?>/><label for="sex-man" style="padding-right:10px;"> 先生 </label>
				<input type="radio" class="radio-box" id="sex-woman" value="1" name="sex" <?php if($info['sex'] == 1) echo 'checked';?>/><label for="sex-woman"> 女士 </label>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>用户类型：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<select class="select" name="type_id" id="type_id" size="1">
					<?php foreach($type as $v):?>
                    <option value="<?php echo $v['id']?>" <?php if($v['id'] == $info['type_id']) echo 'selected';?>><?php echo $v['name']?></option>
					<?php endforeach; ?>
				</select>
			</div>
		</div>
		<div class="row cl" id="sales_target1" hidden>
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>业绩指标：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="<?php echo $info['sales_target']?>" placeholder="请输入金额" id="sales_target" name="sales_target">
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<input type="hidden" name="id" value="<?php echo $info['id']?>" />
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/js/layer.js"></script>
<script type="text/javascript" src="/static/admin/js/H-ui.min.js"></script>
<script type="text/javascript" src="/static/admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.validate.js"></script>
<script type="text/javascript" src="/static/admin/js/validate-methods.js"></script>
<script type="text/javascript" src="/static/admin/js/messages_zh.js"></script>
<!--/_footer /作为公共模版分离出去--> 

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
$(function(){
    var type_id = $('#type_id').val();
    if(type_id == 3){
        $('#sales_target1').show();
    }
    $('#type_id').change(function () {
        var type_id = $('#type_id').val();
        if(type_id == 3){
            $('#sales_target1').show();
        } else{
            $('#sales_target').val('');
            $('#sales_target1').hide();
        }
    });
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#form-add").validate({
		rules:{
			nickname:{ required:true},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			var options = {
				success: function (data) {
					if(data.code==0){
						layer.msg(data.msg,{icon:1,time:1000});
						setInterval("closeWindow()",1000);
					}else{
						layer.msg(data.msg,{icon:5,time:1000});
					}
				}
			};
            var type_id = $('#type_id').val();
            var up_id = $('#up_id').val();
			if(type_id != 1 && up_id == 0){
                layer.msg('请选择上级',{icon:5,time:1000});
            } else{
                $(form).ajaxSubmit(options);
            }
		}
	});
});
function closeWindow() {
	var index = parent.layer.getFrameIndex(window.name);
	window.parent.location.reload();
}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>